<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Options usable with the HttpRequest class and request functions</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="http.constants.html">预定义常量</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="class.httpdeflatestream.html">HttpDeflateStream</a></div>
 <div class="up"><a href="book.http.html">HTTP</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="http.request.options" class="appendix">
 <h1>Options usable with the HttpRequest class and request functions</h1>

 
  <dl>

   <strong class="title">Options related to time outs</strong>
   
    <dt id="http.request.option.timeout">
     timeout (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      seconds the whole request may take to complete
     </span>
    </dd>

   
   
    <dt id="http.request.option.connecttimeout">
     connecttimeout (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      seconds the connect, including name resolving, may take
     </span>
    </dd>

   
   
    <dt id="http.request.option.dns-cache-timeout">
     dns_cache_timeout (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      seconds after an dns cache entry times out
     </span>
    </dd>

   
  </dl>

  <dl>

   <strong class="title">Options related to urls</strong>
   
    <dt id="http.request.option.url">
     url (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      the request url
     </span>
    </dd>

   
   
    <dt id="http.request.option.port">
     port (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      use another port as specified in the url
     </span>
    </dd>

   
   
    <dt id="http.request.option.redirect">
     redirect (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      whether and how many redirects to follow; defaults to 0
     </span>
    </dd>

   
   
    <dt id="http.request.option.unrestrictedauth">
     unrestrictedauth (<span class="type"><a href="language.types.boolean.html" class="type bool">bool</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      whether to continue sending credentials on redirects to a different host
     </span>
    </dd>

   
   
    <dt>

     referer (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      the referring url to send
     </span>
    </dd>

   
  </dl>

  <dl>

   <strong class="title">Options related to cookies</strong>
   
    <dt>

     encodecookies (<span class="type"><a href="language.types.boolean.html" class="type bool">bool</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      whether custom cookies should be <span class="function"><a href="function.urlencode.html" class="function">urlencode()</a></span>d prior sending
     </span>
    </dd>

   
   
    <dt>

     cookies (<span class="type"><a href="language.types.array.html" class="type array">array</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      list of cookies as associative array like <em>array(&quot;cookie&quot; =&gt; &quot;value&quot;)</em>
     </span>
    </dd>

   
   
    <dt>

     cookiestore (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      path to a file where cookies are/will be stored
     </span>
    </dd>

   
   
    <dt>

     cookiesession (<span class="type"><a href="language.types.boolean.html" class="type bool">bool</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      don&#039;t load session cookies from cookiestore if <strong><code>TRUE</code></strong>
     </span>
    </dd>

   
  </dl>

  <dl>

   <strong class="title">Options related to headers</strong>
   
    <dt>

     useragent (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      the user agent to send; defaults to <em>PECL::HTTP/x.y.z (PHP/x.y.z)</em>; omitted if explicitly set to an empty string
     </span>
    </dd>

   
   
    <dt>

     lastmodified (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      timestamp for If-(Un)Modified-Since header
     </span>
    </dd>

   
   
    <dt>

     etag (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      quoted etag for If-(None-)Match header
     </span>
    </dd>

   
   
    <dt>

     headers (<span class="type"><a href="language.types.array.html" class="type array">array</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      list of custom headers as associative array like <em>array(&quot;header&quot; =&gt; &quot;value&quot;)</em>
     </span>
    </dd>

   
  </dl>

  <dl>

   <strong class="title">Options related to authentication</strong>
   
    <dt>

     httpauth (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      http credentials in &quot;user:pass&quot; format
     </span>
    </dd>

   
   
    <dt>

     httpauthtype (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      <a href="http.constants.html#http.constants.request.httpauth" class="link">HTTP authentication type constant</a>
     </span>
    </dd>

   
   
    <dt>

     (<span class="type"><a href="language.types.array.html" class="type array">array</a></span>)
    </dt>

    <dd>

     <span class="simpara">
     </span>
    </dd>

   
  </dl>

  <dl>

   <strong class="title">Options related to proxies</strong>
   
    <dt>

     proxyhost (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      proxy host in &quot;host[:port]&quot; format
     </span>
    </dd>

   
   
    <dt>

     proxyport (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      use another proxy port as specified in proxyhost
     </span>
    </dd>

   
   
    <dt>

     proxytype (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      <a href="http.constants.html#http.constants.request.proxy" class="link">HTTP proxy type constant</a>
     </span>
    </dd>

   
   
    <dt>

     proxyauth (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      proxy credentials in &quot;user:pass&quot; format
     </span>
    </dd>

   
   
    <dt>

     proxyauthtype (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      <a href="http.constants.html#http.constants.request.httpauth" class="link">HTTP authentication type constant</a>
     </span>
    </dd>

   
  </dl>

  <dl>

   <strong class="title">Options related to the transfer</strong>
   
    <dt>

     compress (<span class="type"><a href="language.types.boolean.html" class="type bool">bool</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      whether to request and accept a gzip/deflate content encoded response
     </span>
    </dd>

   
   
    <dt>

     resume (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      start the download at the specified byte offset if server support is given (indicated by a 206 response code)
     </span>
    </dd>

   
   
    <dt>

     range (<span class="type"><a href="language.types.array.html" class="type array">array</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      array of arrays, each containing two <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>s, specifying the ranges to download if server support is given (indicated by a 206 response code);
      only recognized if the resume option is empty
     </span>
    </dd>

   
  </dl>

  <dl>

   <strong class="title">Options imposing limits</strong>
   
    <dt>

     maxfilesize (<span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      maximum file size that should be downloaded;
      has no effect, if the size of the requested entity is unknown
      (eg. dynamic pages with chunked transfer encoding etc.)
     </span>
    </dd>

   
   
    <dt>

     low_speed_limit (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      the lowest transfer speed a successful request may have
     </span>
    </dd>

   
   
    <dt>

     low_speed_time (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      the time in which <em>low_speed_limit</em> must be transferred for a successful request
     </span>
    </dd>

   
   
    <dt>

     max_send_speed (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      maximum send speed in bytes per second
     </span>
    </dd>

   
   
    <dt>

     max_recv_speed (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)
    </dt>

    <dd>

     <span class="simpara">
      maximum receive speed in bytes per second
     </span>
    </dd>

   
  </dl>

  <dl>

   <strong class="title">Callback options</strong>
   
    <dt>
onprogress (<span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span>)</dt>

    <dd>
<span class="simpara">progress callback</span></dd>

   
  </dl>

  <dl>

   <strong class="title">Network options</strong>
   
    <dt>
interface (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

    <dd>
<span class="simpara">outgoing network interface (ifname, ip or hostname)</span></dd>

   
   
    <dt>
portrange (<span class="type"><a href="language.types.array.html" class="type array">array</a></span>)</dt>

    <dd>
<span class="simpara">2 integers specifying outgoing portrange to try</span></dd>

   
  </dl>

  <dl>

   <strong class="title">SSL options</strong>
   
    <dt>

     ssl (<span class="type"><a href="language.types.array.html" class="type array">array</a></span>)
    </dt>

    <dd>

     <blockquote class="note"><p><strong class="note">Note</strong>: 
      <span class="simpara">SSL options are set through an array with the single &quot;ssl&quot; request option name.</span>
     </p></blockquote>
     <dl>

      
       <dt>
cert (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara">path to certificate</span></dd>

      
      
       <dt>
certtype (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara">type of certificate</span></dd>

      
      
       <dt>
certpasswd (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara">password for certificate</span></dd>

      
      
       <dt>
key (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara">path to key</span></dd>

      
      
       <dt>
keytype (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara">type of key</span></dd>

      
      
       <dt>
keypasswd (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara">password for key</span></dd>

      
      
       <dt>
engine (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara">ssl engine to use</span></dd>

      
      
       <dt>
version (<span class="type"><a href="language.types.integer.html" class="type int">int</a></span>)</dt>

       <dd>
<span class="simpara">ssl version to use</span></dd>

      
      
       <dt>
verifypeer (<span class="type"><a href="language.types.boolean.html" class="type bool">bool</a></span>)</dt>

       <dd>
<span class="simpara">whether to verify the peer</span></dd>

      
      
       <dt>
verifyhost (<span class="type"><a href="language.types.boolean.html" class="type bool">bool</a></span>)</dt>

       <dd>
<span class="simpara">whether to verify the host</span></dd>

      
      
       <dt>
cipher_list (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara">list of allowed ciphers</span></dd>

      
      
       <dt>
cainfo (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara"/></dd>

      
      
       <dt>
capath (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara"/></dd>

      
      
       <dt>
random_file (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara"/></dd>

      
      
       <dt>
egdsocket (<span class="type"><a href="language.types.string.html" class="type string">string</a></span>)</dt>

       <dd>
<span class="simpara"/></dd>

      
     </dl>

    </dd>

   
  </dl>

</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="http.constants.html">预定义常量</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="class.httpdeflatestream.html">HttpDeflateStream</a></div>
 <div class="up"><a href="book.http.html">HTTP</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
